package com.aabte.dao;

import com.aabte.model.User;
import org.apache.ibatis.annotations.*;

@Mapper
public interface IUser {

    @Select("select count(*) from user")
    int getUserCount();


    @Insert("insert into user (" +
            "username, password, name, sex, age" +
            ") values(" +
            "#{username}, #{password}, #{name}, #{sex}, #{age})")
    @Options(keyProperty = "id", useGeneratedKeys = true)
    int addUser(User user);

    @Update("update user set " +
            "name=#{name}," +
            "sex=#{sex}," +
            "age=#{age}")
    int updateUser(User user);

    @Delete("delete from user where id = #{id}")
    int deleteUser(Integer id);
}
